function checkform() {

FObj = document.forms[0];

for (i=0; i<FObj.length; i++)
      {
	// for select option fields
      if (FObj.elements[i].value == null && FObj.elements[i].selectedIndex == -1)
			{alert("You must select a value for Field " + FObj.elements[i].name);
			FObj.elements[i].focus();
			return;
			}		
      // for text fields
      else if (FObj.elements[i].value == "" && FObj.elements[i].type!="file"
		 && FObj.elements[i].getAttribute("class")!="optional")
			{alert("Field " + FObj.elements[i].name + " requires a value.");
			FObj.elements[i].focus();
			return;
			}
      }
// if we got here, submit the form
FObj.submit();
}

function checkRadioButtons() {
	FObj = document.forms[0];

	for (var i=0; i<FObj.length; i++) {
		var myElement = FObj.elements[i];
		var gpElement = myElement.parentNode.parentNode;

		if(myElement.type=="radio" && gpElement.style.display=='') {
			var myRB = document.getElementsByName(myElement.name);
			var myStatus = false;
			for(var j=0; j<myRB.length; j++) {
				if(myRB[j].checked) {
					myStatus = true;
					break;
				}
			}

			if (!myStatus) {
				alert("Please choose an answer for Question " + myElement.name.substring(1));
				myElement.focus();
				return;
			}
		} else if (myElement.type == "text" && gpElement.style.display=='' && myElement.className=='required') {
			if (myElement.value == "") {
				alert("Please type an answer for Question " + myElement.name.substring(1));
				myElement.focus();
				return;
			}
		}
	}
	FObj.submit();
}